﻿@{
    ViewBag.Title = "Form";
    Layout = "~/Views/Shared/_ManufactureList.cshtml";
}
<script type="text/javascript">
    var status = '@ViewBag.status';
    var number = '@ViewBag.number';
    $(function () {
        initControl();
    });
    function initControl() {
        if (status == 'U') {
            if ($('#oldEntity').val() != '') {
                var data = JSON.parse($('#oldEntity').val());
                setDataByJson("#form1", data);
            }
            $('#MakeLineNO').prop("readonly", true);
            $('#FirstCompanyNo').prop("disabled", true);
            $('#SecondCompanyNo').prop("disabled", true);
        }
        initBindSelect("#form1");
    }
    function btn_ok() {
        submitForm();
    }
    function submitForm() {
        if (!$('#form1').formValid()) {
            return false;
        }
        $.submitForm({
            url: "/MainData/MakeLine/SubmitMakeLineForm?status=" + status + "&keyValue=" + number,
            param: $("#form1").formSerialize(),
            success: function (result) {
                if (status == 'I') {
                    parent.reloadGrid(result.data);
                } else {
                    parent.reloadGrid();
                }
                parent.$.detailClose();
            }
        })
    }
    function btn_cancel() {
        parent.$.detailClose();
    }
</script>
<div class="ui-layout" id="layout" style="height: 96%; width: 100%;">
    <input id="oldEntity" type="hidden" value="@ViewBag.oldEntity" />
    <form id="form1">
        <div style="width:900px;margin:0 auto;">
            <table class="form" style="width:900px;text-align:right;margin:15px;border-bottom:2px solid #ccc;">
                <tr>
                    <td class="formValue input-width-185" style="width:500px;padding-left:100px;text-align:left;">
                        &nbsp;
                    </td>
                    <td style="width: 300px; padding: 5px 10px;">
                        <div class="btn-group" style="margin-right:20px;">
                            <a id="" class="btn btn-primary center-block" onclick="btn_ok()"><span class="glyphicon glyphicon-ok"></span> 确认</a>
                        </div>
                        <div class="btn-group">
                            <a id="" class="btn btn-primary center-block" onclick="btn_cancel()"><span class="glyphicon glyphicon-remove"></span> 取消</a>
                        </div>
                    </td>
                </tr>
            </table>
            <table class="form" style="width: 900px;">
                <tr>
                    <th class="formTitle" style="width:200px;">一级单位</th>
                    <td class="formValue input-width-320">
                        <select id="FirstCompanyNo" name="FirstCompanyNo" class="form-control required">
                            @foreach (var item in ViewBag.firstCompanyNo)
                            {
                                <option value="@item.UnitNO">@item.UnitNO @item.UnitShortName</option>
                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">二级单位</th>
                    <td class="formValue input-width-320">
                        <select id="SecondCompanyNo" name="SecondCompanyNo" class="form-control required">
                            @foreach (var item in ViewBag.secondCompanyNo)
                            {
                                <option value="@item.UnitNO">@item.UnitNO @item.UnitShortName</option>
                            }
                        </select>
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">路线编码</th>
                    <td class="formValue input-width-40">
                        <input id="MakeLineNO" name="MakeLineNO" type="text" class="form-control required" maxlength="2" value="" />
                        <input id="MakeLineID" name="MakeLineID" type="hidden" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">路线名称</th>
                    <td class="formValue input-width-480">
                        <input id="MakeLineName" name="MakeLineName" type="text" class="form-control required" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">路线简称</th>
                    <td class="formValue input-width-320">
                        <input id="MakeLineShortName" name="MakeLineShortName" type="text" class="form-control" value="" />
                    </td>
                </tr>
                <tr>
                    <th class="formTitle">路线附注</th>
                    <td class="formValue input-width-480">
                        <input id="MakeExplain" name="MakeExplain" type="text" class="form-control" value="" />
                    </td>
                </tr>
            </table>
        </div>
    </form>
</div>

